let count = 1;
let promiseFunction = () => {
    return new Promise(rs => {
        setTimeout(() => {
            rs(count++);
        })
    })
}
function lastPromise(fn) {
    let timer = null
    return async (...args) => {
      const response = await fn(...args)
      clearTimeout(timer)
      return new Promise((resolve) => {
        timer = setTimeout(async () => {
            resolve(response)
        }, 0)
      })
    }
}
let lastFn = lastPromise(promiseFunction);
lastFn().then((a) => console.log(a))
lastFn().then((a) => console.log(a))
lastFn().then((a) => console.log(a))